package ipc.project;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class AddFriendActivity extends Activity implements OnClickListener {
	public Context context = this;
	private User user;
	Button btnFind;
	TextView txtLogin;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.add_friend_screen);
		user=((App)getApplication()).getUser();

		btnFind = (Button) findViewById(R.id.buttonAddFriend);
		btnFind.setOnClickListener(this);

		txtLogin = (TextView) findViewById(R.id.textLogin);
	}

	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.buttonAddFriend:
			String login=txtLogin.getText().toString().trim();
			if(login.length()>0){
				user.sendRequestToBeFriends(login);
				startActivity(new Intent(context, MainActivity.class));
				finish();}
			break;
		}

	}

}
